package imusic4j.interfaces;

import imusic4j.RestUrlPath;
import imusic4j.util.HttpUtils;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class MoonCloudMusic {
	
	public String getAlbumMusicList(String mdn,
			String albumid, int startindex, int pagesize) {
		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
		nvps.add(new BasicNameValuePair("mdn", mdn));
		nvps.add(new BasicNameValuePair("albumid", albumid));
		nvps.add(new BasicNameValuePair("startindex", String.valueOf(startindex)));
		nvps.add(new BasicNameValuePair("pagesize", String.valueOf(pagesize)));
		return HttpUtils.httpGetTool(nvps, RestUrlPath.MOONCLOUD_URL, "getalbummusiclist", RestUrlPath.RETURN_TYPE_JSON);
	}
	
	public String getDefaultAlbum(String mdn) {
		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
		nvps.add(new BasicNameValuePair("mdn", mdn));
		return HttpUtils.httpGetTool(nvps, RestUrlPath.MOONCLOUD_URL, "getdefaultalbum", RestUrlPath.RETURN_TYPE_JSON);
	}
	
	public String getSongInfo(String songid) {
		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
		nvps.add(new BasicNameValuePair("songid", songid));
		return HttpUtils.httpGetTool(nvps, RestUrlPath.MOONCLOUD_URL, "getsonginfo", RestUrlPath.RETURN_TYPE_JSON);
	}
	
	public String getUserAlbumList(String mdn,String ordertype) {
		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
		nvps.add(new BasicNameValuePair("mdn", mdn));
		nvps.add(new BasicNameValuePair("ordertype", ordertype));
		return HttpUtils.httpGetTool(nvps, RestUrlPath.MOONCLOUD_URL, "getuseralbumlist", RestUrlPath.RETURN_TYPE_JSON);
	}
	
	public String getUserCapacity(String mdn) {
		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
		nvps.add(new BasicNameValuePair("mdn", mdn));
		return HttpUtils.httpGetTool(nvps, RestUrlPath.MOONCLOUD_URL, "getusercapacity", RestUrlPath.RETURN_TYPE_JSON);
	}
}
